---
title: "Get"
"og:title": "dub.links.get - Retrieve a link - TypeScript SDK"
description: "Retrieve info for a link by specifying either the domain and key or the linkId or externalId"
---

import LinkResponse from "/snippets/link-response.mdx";

## Arguments

<ParamField body="domain" type="string">
  The domain of the link to retrieve. E.g. for `d.to/github`, the domain is
  `d.to`.
</ParamField>

<ParamField body="key" type="string">
  The key of the link to retrieve. E.g. for `d.to/github`, the key is `github`.
</ParamField>

<ParamField body="linkId" type="string">
  The unique ID of the short link.
</ParamField>

<ParamField body="externalId" type="string">
  This is the ID of the link in the your database. Must be prefixed with `ext_`
  when provided.
</ParamField>

## Response

<LinkResponse />

<RequestExample>

```ts
// Retrieve a link by domain and key
await dub.links.get({
  domain: "dub.sh",
  key: "e7qzMuI",
});

// Retrieve a link by linkId
await dub.links.get({
  linkId: "clv3o9p9q000au1h0mc7r6l63",
});

// Retrieve a link by externalId
await dub.links.get({
  externalId: "ext_123",
});
```

</RequestExample>

<ResponseExample>

```ts
{
  id: 'clv3o9p9q000au1h0mc7r6l63',
  domain: 'dub.sh',
  key: 'e7qzMuI',
  externalId: "123",
  url: 'https://www.google.com',
  archived: false,
  expiresAt: null,
  expiredUrl: null,
  password: null,
  proxy: false,
  title: null,
  description: null,
  image: null,
  rewrite: false,
  ios: null,
  android: null,
  geo: null,
  publicStats: false,
  tagId: null,
  tags: [],
  comments: null,
  shortLink: 'https://dub.sh/e7qzMuI',
  qrCode: 'https://api.dub.co/qr?url=https://dub.sh/e7qzMuI?qr=1',
  utmSource: null,
  utmMedium: null,
  utmCampaign: null,
  utmTerm: null,
  utmContent: null,
  userId: 'cludszk1h0000wmd2e0ea2b0p',
  workspaceId: 'ws_clugls3tn000lwfotbpy30304',
  clicks: 0,
  lastClicked: null,
  createdAt: '2024-04-17T10:31:00.398Z',
  updatedAt: '2024-04-17T10:31:00.398Z',
  projectId: 'clugls3tn000lwfotbpy30304'
}
```

</ResponseExample>
